package com.wzz.seckillone.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

//公用返回对象

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RespBean {

    private long code;
    private String message;
    private Object obj;

    public static RespBean success(RespBeanEnum respBeanEnum){
        return new RespBean(respBeanEnum.SUCCESS.getCode(), respBeanEnum.SUCCESS.getMessage(),null);
    }

    public static RespBean success(RespBeanEnum respBeanEnum,Object obj){
        return new RespBean(respBeanEnum.SUCCESS.getCode(), respBeanEnum.SUCCESS.getMessage(),obj);
    }

    public static RespBean error(RespBeanEnum respBeanEnum){
        return new RespBean(respBeanEnum.ERROR.getCode(), respBeanEnum.ERROR.getMessage(), null);
    }
    public static RespBean error(RespBeanEnum respBeanEnum,Object obj){
        return new RespBean(respBeanEnum.ERROR.getCode(), respBeanEnum.ERROR.getMessage(), obj);
    }

    public static RespBean loginError(RespBeanEnum respBeanEnum){
        return new RespBean(respBeanEnum.LOGIN_ERROR.getCode(), respBeanEnum.LOGIN_ERROR.getMessage(), null);
    }
    public static RespBean loginError(RespBeanEnum respBeanEnum,Object obj){
        return new RespBean(respBeanEnum.LOGIN_ERROR.getCode(), respBeanEnum.LOGIN_ERROR.getMessage(), obj);
    }
}
